#-*-coding:utf-8-*-
# 时间相关
import time
from datetime import datetime,date
import calendar

# 是否闰年
def is_leap(year):
	return calendar.isleap(year)


if __name__ == "__main__":
	curTime = time.time()
	local_time = time.localtime(curTime)
	print "current time = {}".format(curTime)
	print "local_time = {}".format(local_time)
	print "year = {}, month = {} ,day = {},hour = {} ,minute = {},second = {}".format(local_time.tm_year,
	                                                                                  local_time.tm_mon,
	                                                                                  local_time.tm_mday,
	                                                                                  local_time.tm_hour,
	                                                                                  local_time.tm_min,
	                                                                                  local_time.tm_sec)
	formatTime = time.strftime("%Y-%m-%d %H:%M:%S",local_time)
	print "formatTime = {}".format(formatTime)

	print "today = {}".format(date.today())

	print "current format time = {}".format(datetime.now())
	print "current format date time = {}".format(datetime.strftime(datetime.now(),"%Y-%m-%d %H:%M:%S"))

	dateTimeToday = datetime(2021,8,7,15,23,0)
	print "datetime today = {}".format(dateTimeToday)


	year_calendar_str = calendar.calendar(2021)
	print year_calendar_str

	print "{} is leap = {}".format(datetime.now().year,is_leap(datetime.now().year))